import java.util.Arrays;
import java.util.Scanner;

public class ArrayMerge {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a1 = new int[n];
//        对应C的柔性数组
        for (int i = 0; i < n; i++) {
            a1[i] = in.nextInt();
        }

        int m = in.nextInt();
        int[] a2 = new int[m];
        for (int i = 0; i < m; i++) {
            a2[i] = in.nextInt();
        }
        int[] a3 = new int[m + n];
        System.arraycopy(a2,0, a3, 0, m);
        System.arraycopy(a1,0, a3, m , n);

        Arrays.sort(a3);
        for(int e:a3) {
            System.out.printf("%d ",e);
        }
    }
}


